<!--
 * @Author: windys
 * @Description: 协议
 * @Date: 2022-02-24 10:26:27
-->
<template>
  <van-action-sheet v-model:show="show" title="用户协议">
    <div class="content">
      <div v-html="data"></div>
      <div class="footer">
        <van-button type="warning" size="small" round block @click="handleAgree"
          >同意协议</van-button
        >
      </div>
    </div>
  </van-action-sheet>
</template>



<script >
import { defineComponent, ref, watch } from "vue";
import { getAgreement } from "@/api/common";
export default defineComponent({
  setup(props, { emit }) {
    const show = ref(false);
    const data = ref(null);
    watch(
      () => show.value,
      async (v) => {
        if (v) {
          const res = await getAgreement({});
          if (res) {
            data.value = res;
          }
        }
      }
    );
    const handleAgree = () => {
      emit("handleAgree", true);
      
    };
    return {
      show,
      data,
      handleAgree,
    };
  },
});
</script>


<style lang="scss" scoped>
.content {
  font-size: 14px;
  padding: 20px;
}
</style>